var HOST_NAME_LOCATION = ((window.location.hostname == 'localhost')? '/jobportal' : '');
var __HOST_NAME__ = 'http://' + window.location.hostname + HOST_NAME_LOCATION;
var xhrRequest; //ajax request handler

/* @Ajax load ($.ajax)
 * @date June 20 2011
 * @Params
 * ajaxDiv = div to which load the content
 * ajaxUrl = url of the location
 * ajaxType = GET or POST , default = POST
 * ajaxData = data to be sent over url , default = null
 * ajaxLoading = whether to show the loading image or not . default =true 
*/

function ajaxLoad(ajaxDiv, ajaxUrl, ajaxData, ajaxType, ajaxLoading){
	if(!ajaxData)
		ajaxData = null;
	if(!ajaxType)
		ajaxType = "POST";
	if(!ajaxLoading && ajaxLoading != false)
		ajaxLoading = true;
	if (xhrRequest != null) {
		xhrRequest.abort();
		xhrRequest = null;
	}
	/*if(ajaxLoading)
		$(ajaxDiv).html('<img class="loading" src="' + __HOST_NAME__ + '/img/loading.gif" />');*/
	
	xhrRequest = $.ajax({
			url: ajaxUrl,
			type: ajaxType,
			data: ajaxData, 
			success: function(result){
				$(ajaxDiv).html(result);
				xhrRequest = null;
			}
	});
}
